package com.yonyou.cyxdms.sysAuth.service.entity.message;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.yonyou.cyx.framework.bean.dto.base.BaseDTO;
import com.yonyou.cyx.function.utils.bean.BeanMapperUtil;

import java.io.Serializable;
import java.time.LocalDateTime;

/**
 * <p>
 *
 * </p>
 *
 * @author renwd
 * @since 2019-10-17
 */
@TableName("producer_msg")
public class ProducerMsgPO implements Serializable {

    private static final long serialVersionUID = 1L;

    /**
     * 主键id
     */
    @TableId(value = "id", type = IdType.AUTO)
    private Long id;
    /**
     * 消息key
     */
    @TableField("msg_key")
    private String msgKey;
    /**
     * 业务类名称
     */
    @TableField("biz_class_name")
    private String bizClassName;
    /**
     * 创建时间
     */
    @TableField("create_time")
    private LocalDateTime createTime;
    /**
     * 交换机名称
     */
    @TableField("exchange")
    private String exchange;
    /**
     * 消息异常信息
     */
    @TableField("info_msg")
    private String infoMsg;
    /**
     * 消息体内容
     */
    @TableField("msg_content")
    private String msgContent;
    /**
     * 发送次数
     */
    @TableField("retry_count")
    private Integer retryCount;
    /**
     * 消息队列名称
     */
    @TableField("router_key")
    private String routerKey;
    /**
     * 消息状态：0 消息发送初始化,1 消息发送成功,2消息发送失败
     */
    @TableField("status")
    private Integer status;
    /**
     * 更新时间
     */
    @TableField("update_time")
    private LocalDateTime updateTime;

    public ProducerMsgPO() {
        super();
    }


    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getMsgKey() {
        return msgKey;
    }

    public void setMsgKey(String msgKey) {
        this.msgKey = msgKey;
    }

    public String getBizClassName() {
        return bizClassName;
    }

    public void setBizClassName(String bizClassName) {
        this.bizClassName = bizClassName;
    }

    public LocalDateTime getCreateTime() {
        return createTime;
    }

    public void setCreateTime(LocalDateTime createTime) {
        this.createTime = createTime;
    }

    public String getExchange() {
        return exchange;
    }

    public void setExchange(String exchange) {
        this.exchange = exchange;
    }

    public String getInfoMsg() {
        return infoMsg;
    }

    public void setInfoMsg(String infoMsg) {
        this.infoMsg = infoMsg;
    }

    public String getMsgContent() {
        return msgContent;
    }

    public void setMsgContent(String msgContent) {
        this.msgContent = msgContent;
    }

    public Integer getRetryCount() {
        return retryCount;
    }

    public void setRetryCount(Integer retryCount) {
        this.retryCount = retryCount;
    }

    public String getRouterKey() {
        return routerKey;
    }

    public void setRouterKey(String routerKey) {
        this.routerKey = routerKey;
    }

    public Integer getStatus() {
        return status;
    }

    public void setStatus(Integer status) {
        this.status = status;
    }

    public LocalDateTime getUpdateTime() {
        return updateTime;
    }

    public void setUpdateTime(LocalDateTime updateTime) {
        this.updateTime = updateTime;
    }

    @Override
    public String toString() {
        return "ProducerMsgPO{" +
                "id=" + id +
                ", msgKey=" + msgKey +
                ", bizClassName=" + bizClassName +
                ", createTime=" + createTime +
                ", exchange=" + exchange +
                ", infoMsg=" + infoMsg +
                ", msgContent=" + msgContent +
                ", retryCount=" + retryCount +
                ", routerKey=" + routerKey +
                ", status=" + status +
                ", updateTime=" + updateTime +
                "}";
    }


    /**
     * 将PO 信息转化为DTO
     *
     * @param dto 需要进行转换的dto
     * @author renwd
     * @since 2018/7/22 0022
     */
    protected <T extends BaseDTO> void transDtoToPo(T dto) {
        BeanMapperUtil.copyProperties(this, dto, "id");
    }


}
